﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace SettingsModuleAddin
{
    /// <summary>
    /// Interaction logic for UserControl1.xaml
    /// </summary>
    public partial class UserControl1 : UserControl
    {
        public Acceron.University.Core.Addins.AddinManager addManager = Acceron.University.Core.Addins.AddinManager.Instanse;

        public UserControl1()
        {
            InitializeComponent();
            Binding itemsBind = new Binding("Modules");
            itemsBind.Source = addManager;
            listBoxModules.SetBinding(ListBox.ItemsSourceProperty, itemsBind);
        }

        private void button2_Click(object sender, RoutedEventArgs e)
        {
            // TODO: Add searching in web modules

            ShowNotImplemented();
        }

        private void ShowNotImplemented()
        {
            MessageBox.Show("This functinality is not implemented yet.\n Coming soon...");
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            // TODO: Add facility for adding local modules
            ShowNotImplemented();
        }

        private void button10_Click(object sender, RoutedEventArgs e)
        {
            
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var win = addManager.Modules.First(mod => mod.Name == ((Button)sender).Tag.ToString()).PropertiesWindow;
            if (win != null)
            {
                win.ShowDialog();
            }
        }
    }
}
